﻿using System;
using System.Collections.Generic;
using Day1Logger;   // 引入命名空间

List<double> temps = TemperatureService.GenerateTemps(100, -10, 45);

while (true)
{
    Console.Clear();
    Console.WriteLine("=== 冷链温度记录仪 ===");
    Console.WriteLine("1. 重新生成 100 条温度");
    Console.WriteLine("2. 显示统计");
    Console.WriteLine("3. 退出");
    Console.Write("请选择(1-3): ");

    string? input = Console.ReadLine();

    if (input == "1")
    {
        temps = TemperatureService.GenerateTemps(100, -10, 45);
        Console.WriteLine("已重新生成！");
    }
    else if (input == "2")
    {
        var stat = TemperatureService.Statistics(temps);
        Console.WriteLine($"最高: {stat.Highest:F1} ℃");
        Console.WriteLine($"最低: {stat.Lowest:F1} ℃");
        Console.WriteLine($"平均: {stat.Average:F1} ℃");
    }
    else if (input == "3") break;
    else Console.WriteLine("输入无效");

    Console.WriteLine("\n按任意键继续...");
    Console.ReadKey();
}